<?php

/**
 * 首页类
 * @author MrHan<hcj112@163.com>
 */
class IndexController extends CommonController
{


    /**
     * 前台首页
     * @author MrHan<hcj112@163.com>
     */
    public function index()
    {
        $this->display();
    }


    /**
     * 文章内容页
     * @author MrHan<hcj112@163.com>
     */
    public function show()
    {
        $result = D('Article')->getArticleById();
        if (false != $result) {
            $this->assign('res', $result);
            $this->display('article');
        } else {
            $this->error('该文章不存在!');
        }
    }


    /**
     * 标签对应的文章
     */

    public function tag()
    {
        $pinyin = I('get.pinyin');
        if (empty($pinyin)) {
            $this->error('该数据不存在');
        }

        $list = D('Article')->getArticleByTag($pinyin);

        $this->assign('list', $list);
        $this->display();
    }
}